<?php

class User {

    private $name;
    private $gamesPlayed;
    private $rating;

    public function __construct($name, $gamesPlayed, $rating) {
        $this->name = $name;
        $this->gamesPlayed = $gamesPlayed;
        $this->rating = $rating;
    }
    
    public function save() {
        $db = DBUtils::Create();
        $db->saveUser($this->name, $this->gamesPlayed, $this->rating);
    }
    
    public static function load($name) {
        $db = DBUtils::Create();
        return $db->loadUser($name);
    }
    
    public function getRating() {
        return $this->rating;
    }
    
    public function getGamesPlayed() {
        return $this->gamesPlayed;
    }
    
    public function setRating($rating) {
        $this->rating = $rating;
    }
    
    public function  setGamesPlayed($gamesPlayed) {
        $this->gamesPlayed = $gamesPlayed;
    }

}

?>